import numpy as np
import os

def print_res(data_dir, metric):

    names = ['Adw', 'Drp', 'Rtk', 'Susp', 'Trj', 'CTU_Normal_vs_Adw_Drp_Rtk_Susp']
    algs = ['svm', 'knn', 'dt', 'nn', 'mv']
    # algs = ['mv_ablation_study_view_0', 'mv_ablation_study_view_1', 'mv_ablation_study_view_2', 'mv']

    for name in names:
        tmp = ''
        for alg in algs:
            if name == 'CTU_Normal_vs_Adw_Drp_Rtk_Susp':
                data_path = data_dir + 'CTU_Normal_vs_Adw_Drp_Rtk_Susp_{}_res.npz'.format(alg)
            else:
                data_path = data_dir + 'CTU_Normal_vs_{}_{}_res.npz'.format(name, alg)
            if not os.path.exists(data_path):
                tmp += '-, '
                continue
            data = np.load(data_path)
            try:
                x = data[metric]
            except:
                x = data[metric+'s'][-1]
            tmp += '{:.4f}, '.format(x)
        print(tmp)




if __name__ == '__main__':

    print('fpr')
    print_res('./', 'fpr')
    print('fnr')
    print_res('./', 'fnr')
    print('error_rate')
    print_res('./', 'error_rate')